package org.hzy.test;

import org.hzy.exceptions.MyException;
import org.hzy.services.IMyService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest1 {
	public static void main(String[] args) throws MyException {
		ApplicationContext ctx=new ClassPathXmlApplicationContext("beans1.xml");
//		MyService my=ctx.getBean("Myservice",MyService.class);//Add CGLIB to the class path or specify proxy interfaces
		IMyService my=ctx.getBean("Myservice",IMyService.class);//由于返回的是代理,代理与MyService不相干,不能转换,所有要实现接口
//		my.add_user("hzy");
//		my.add();
		
//		my.add(1);
/*		try {
			my.add(1);
		} catch (Exception e) {
			// TODO: handle exception
			System.out.println("错误!!!!!!!!!!!");//会先走拦截方法
		}*/
		
		my.add(12,"aa");
			
	}
}
